#include "DisjointSet.h"
#include <stdio.h>
#include <stdlib.h>

void Initialize(DisjointSet S) {
    int i;
    for (int i = 1; i <= NumSets; i++) {
        S[i] = 0;
    }
}

void SetUnion(DisjointSet S, SetType root1, SetType root2) {
    S[root2] = root1;
}

SetType Find(ElementType x, DisjointSet S) {
    if (S[x] <= 0)
        return x;
    else
        return Find(S[x], S);
}